<?php

namespace App\Console\Commands;

use App\Providers\DatabaseProvider;
use App\Services\Database;
use App\Services\Table;
use Illuminate\Console\Command;
use Illuminate\Container\Container;
use Illuminate\Events\Dispatcher;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\ConnectionResolver;
use Illuminate\Database\Capsule\Manager;

class zhang extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'zhang';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        // $res = DB::connection('app')->table('tpconfig')->first();
        // $res = Database::create('hahaha', false);
        $columns = [
            ['name' => 'name',  'type'  => 'string',    'length' => 20, 'newname' => ''],
            ['name' => 'age',   'type'  => 'integer',   'length' => 3,  'newname' => ''],
            ['name' => 'head',  'type'  => 'string',    'length' => 10, 'newname' => '']
        ];
        // Table::create('users', $columns);
        Table::update('users', $columns);
        return 0;
    }
}
